home *** CD-ROM | disk | FTP | other *** search
/ Mac Expert 1995 Winter / Mac Expert - Winter 95.iso / Les fichiers / Communications / AppleTalk Remote access / Scripts ARA ƒ / PowerPort; SupraCallBack / PowerPort; SupraCallBack
Encoding:
Text File  |  1992-09-05  |  7.8 KB  |  404 lines  |  [mlts/slnk]

  1. !
  2. ! AppleTalk Remote Access Script
  3. ! For use with Global Village PowerPort/GOLD /SILVER and /BRONZE
  4. !
  5. ! 6/21/92  AN   Added "pause 30" right after @LABEL 30 to fix a problem
  6. !               with the PowerBook hanging when AUTO_ANSWER was selected.
  7. !               Also changed all &F strings to &F&C1&D1.
  8. ! 6/13/92  AN   Always save &C1&D1 to NVRAM in Bronze
  9. !          AN   Fixed bug where PowerPort/Bronze was not being recognized
  10. ! 6/06/92  LAL  ORIGINAL RELEASE
  11. !
  12. !
  13. @ORIGINATE
  14. @ANSWER
  15. !
  16. ! Talk to the modem at 2400 bps.
  17. !
  18. serreset 2400, 0, 8, 1
  19. !
  20. ! First recall the factory configuration
  21. !
  22. settries 0
  23. matchclr
  24. @LABEL 1
  25. matchstr 1 3 "OK\13\10"
  26. write "AT&F&C1&D1\13"
  27. matchread 30
  28. inctries
  29. iftries 2 59
  30. !
  31. ! Modem is not responding, reset and send a break
  32. !
  33. DTRClear
  34. pause 5
  35. DTRSet
  36. SBreak
  37. jump 1
  38. !
  39. ! Which PowerPort is in use?  High Speed (961) or Low Speed (242)?
  40. !
  41. @LABEL 3
  42. matchclr
  43. matchstr 1 68 "242\13\10\13\10OK\13\10"
  44. matchstr 2  4 "961\13\10\13\10OK\13\10"
  45. write "ATI0\13"
  46. matchread 30
  47. note "Not a Global Village PowerPort." 2
  48. jump 59
  49. !
  50. ! PowerPort Silver or Gold Continues Here
  51. !
  52. @LABEL 4
  53. note "Initializing high speed PowerPort..." 2
  54. !
  55. ! Now talk to the modem at 19200 bps.
  56. !
  57. serreset 19200, 0, 8, 1
  58. settries 0
  59. matchclr
  60. pause 5
  61. matchstr 1 5 "OK\13\10"
  62. write "ATE0X3S0=0\13"
  63. matchread 30
  64. iftries 2 59
  65. ! Modem is not responding, reset and send a break
  66. SBreak
  67. jump 4
  68. !
  69. !
  70. ! Next, disable MNP and error control
  71. ! turn on internal buffering (for V.32bis)
  72. ! and extended result codes 
  73. ! &d1 - DTR on/off goes to command mode
  74. ! \k0 - Go into command mode when receiving break from DTE (see
  75. !       @HANGUP for why we care about this).
  76. ! \n0 - Turn off all error detection/correction (ARA does MNP and
  77. !       compression itself.  It needs these turned off in the modem).
  78. ! \j0 - Turn *on* DTE <-> line buffering if there is no error control
  79. !       (which there is not).  Since we will be talking to the Mac at
  80. !       19,200 bps no matter what speed we connect at, we need this on.
  81. !
  82. @LABEL 5
  83. pause 5
  84. matchstr 1 6 "OK\13\10"
  85. write "AT%C0\\N0\\k0\\J0\\q3\13"
  86. matchread 30
  87. jump 59
  88. !
  89. !
  90. ! If speaker on flag is true, jump to label 8.  Else turn off the speaker
  91. !
  92. @LABEL 6
  93. ifstr 2 8 "1"
  94. pause 5
  95. matchstr 1 8 "OK\13\10"
  96. write "ATM0\13"
  97. matchread 30
  98. jump 59
  99. !
  100. ! The modem is ready so enable answering, or originate a call
  101. !
  102. @LABEL 8
  103. pause 5
  104. ifANSWER 30
  105. note "Dialing ^1" 3
  106. write "ATDT^1\13"
  107. !
  108. @LABEL 9
  109. matchstr 1  11 "CONNECT 1200\13\10"
  110. matchstr 2  12 "CONNECT 2400\13\10"
  111. matchstr 3  13 "CONNECT 4800\13\10"
  112. matchstr 4  19 "CONNECT 7200\13\10"
  113. matchstr 5  14 "CONNECT 9600\13\10"
  114. matchstr 6  20 "CONNECT 12000\13\10"
  115. matchstr 7  18 "CONNECT 14400\13\10"
  116. matchstr 8  50 "NO CARRIER\13\10"
  117. matchstr 9  50 "ERROR\13\10"
  118. matchstr 10 52 "NO DIAL TONE\13\10"
  119. matchstr 11 53 "BUSY\13\10"
  120. matchstr 12 54 "NO ANSWER\13\10"
  121. matchread 700
  122. jump 59
  123. !
  124. ! Notice that all we do for different connect speeds is issue a 
  125. ! "CommunicatingAt" command.  Remember, we locked the interface speed
  126. ! to 19,200 bps so we don't want to reset the serial speed after we connect.
  127. ! CommunicatingAt tells ARA what the actual line speed is so that it
  128. ! can set it's timers appropriately.  I guess your performance would be
  129. ! sub-optimal if you don't set this...
  130. !
  131. @LABEL 11
  132. note "Communicating at 1200 bps." 2
  133. CommunicatingAt 1200
  134. jump 15
  135. !
  136. @LABEL 12
  137. note "Communicating at 2400 bps." 2
  138. CommunicatingAt 2400
  139. jump 15
  140. !
  141. @LABEL 13
  142. note "Communicating at 4800 bps." 2
  143. CommunicatingAt 4800
  144. jump 15
  145. !
  146. @LABEL 19
  147. note "Communicating at 7200 bps." 2
  148. CommunicatingAt 7200
  149. jump 15
  150. !
  151. @LABEL 14
  152. note "Communicating at 9600 bps." 2
  153. CommunicatingAt 9600
  154. jump 15
  155. !
  156. @LABEL 20
  157. note "Communicating at 12000 bps." 2
  158. CommunicatingAt 12000
  159. jump 15
  160. !
  161. @LABEL 18
  162. note "Communicating at 14400 bps." 2
  163. CommunicatingAt 14400
  164. jump 15
  165. !
  166. ! Set CTS handshaking ON in the serial port (that's the 1 in the HSReset
  167. ! command below )
  168. !
  169. @LABEL 15
  170. HSReset 0 1 0 0 0 0 
  171. ifANSWER 16
  172. pause 30
  173. @LABEL 16
  174. exit 0
  175. !
  176. ! @ANSWER for PowerPort SILVER and GOLD
  177. ! Set up the modem to answer
  178. !
  179. @LABEL 30
  180. pause 30
  181. write "ATS0=1\13"
  182. matchclr
  183. matchstr 1 31 "OK\13\10"
  184. matchread 30
  185. jump 59
  186. !
  187. @LABEL 31
  188. matchstr 1  32 "RING\13\10"
  189. matchstr 2  11 "CONNECT 1200\13\10"
  190. matchstr 3  12 "CONNECT 2400\13\10"
  191. matchstr 4  13 "CONNECT 4800\13\10"
  192. matchstr 5  19 "CONNECT 7200\13\10"
  193. matchstr 6  14 "CONNECT 9600\13\10"
  194. matchstr 7  20 "CONNECT 12000\13\10"
  195. matchstr 8  18 "CONNECT 14400\13\10"
  196. matchstr 9  50 "NO CARRIER\13\10"
  197. matchstr 10 50 "ERROR\13\10"
  198. matchstr 11 52 "NO DIAL TONE\13\10"
  199. matchstr 12 53 "BUSY\13\10"
  200. matchstr 13 54 "NO ANSWER\13\10"
  201. matchread 700
  202. jump 31
  203. !
  204. @LABEL 32
  205. userhook 1
  206. note "Answering phone..." 2
  207. pause 10
  208. jump 31
  209. !
  210. ! 50: error messages
  211. !
  212. @LABEL 50
  213. exit -6021
  214. !
  215. @LABEL 52
  216. exit -6020
  217. !
  218. @LABEL 53
  219. exit -6022
  220. !
  221. @LABEL 54
  222. exit -6023
  223. !
  224. @LABEL 59
  225. exit -6019
  226. !
  227. ! Hang up the modem
  228. ! Note:  If DTR is used to hang up the modem immediately, this
  229. !        can have the ill effect of hanging up before all the data
  230. !        in the modem's internal transmit buffer has been sent.
  231. !        It is very desirable to have the last byte of data sent make
  232. !        it out of the modem and across the phone line.  Typically,
  233. !        the last packet sent is the disconnect packet, and if
  234. !        the other side misses this packet, it may have to wait for a
  235. !        time out (~45 seconds) to hang up.
  236. !
  237. !
  238. !
  239. @HANGUP
  240. @LABEL 60
  241. settries 0
  242. HSReset 0 0 0 0 0 0 
  243. @LABEL 61
  244. !
  245. ! Now, issue clear the DTR to instruct the modem to Hang Up.
  246. !
  247. DTRSet
  248. pause 5
  249. DTRClear
  250. pause 5
  251. DTRSet
  252. pause 10
  253. sbreak
  254. !
  255. matchclr
  256. matchstr 1 63 "NO CARRIER\13\10"
  257. matchstr 2 63 "OK\13\10"
  258. matchstr 3 63 "ERROR\13\10"
  259. matchread 30
  260. inctries
  261. iftries 3 63
  262. ! no response, try escape sequence
  263. write "+++"
  264. matchclr
  265. matchstr 1 62 "OK\13\10"
  266. matchread 15
  267. !
  268. ! No Response from modem, toggle DTR
  269. !
  270. DTRClear
  271. pause 5
  272. DTRSet
  273. jump 61
  274. !
  275. ! Pause 1 second before to ensure we meet the escape time delay
  276. !
  277. @LABEL 62
  278. pause 10
  279. Flush
  280. write "ATH\13"
  281. matchstr 1 63 "OK\13\10"
  282. matchstr 2 63 "NO CARRIER\13\10"
  283. matchstr 3 63 "ERROR\13\10"
  284. matchread 30
  285. jump 61
  286. !
  287. ! recall the factory settings. (see note at top of script)
  288. !
  289. @LABEL 63
  290. matchclr
  291. matchstr 1 64 "OK\13\10"
  292. pause 15
  293. write "AT&F&C1&D1\13"
  294. matchread 30
  295. !
  296. !
  297. @LABEL 64
  298. matchclr
  299. matchstr 1 65 "OK\13\10"
  300. pause 15
  301. write "ATH0&C1&D1\13"
  302. matchread 30
  303. !
  304. !
  305. @LABEL 65
  306. exit 0
  307. !
  308. !
  309. !
  310. ! ------------------- POWERPORT/BRONZE -------------------
  311. !
  312. ! PowerPort Bronze Continues Here
  313. !
  314. @LABEL 68
  315. note "Initializing PowerPort/Bronze..." 2
  316. matchclr
  317. matchstr 1 69 "OK\13\10"
  318. write "AT&C1&D1&W0&W1\13"
  319. pause 5
  320. matchread 30
  321. jump 59
  322. !
  323. ! Turn off local echo, ignore NO DIALTONE and BUSY
  324. !
  325. @LABEL 69
  326. matchclr
  327. matchstr 1 70 "OK\13\10"
  328. write "ATE0X3S0=0\13"
  329. pause 5
  330. matchread 30
  331. jump 59
  332. !
  333. ! If speaker on flag is true, jump to label 8.  Else turn off the speaker
  334. !
  335. @LABEL 70
  336. ifstr 2 71 "1"
  337. pause 5
  338. matchstr 1 71 "OK\13\10"
  339. write "ATM0\13"
  340. matchread 30
  341. jump 59
  342. !
  343. ! The modem is ready so enable answering, or originate a call
  344. !
  345. @LABEL 71
  346. pause 5
  347. ifANSWER 100
  348. note "Dialing ^1" 3
  349. write "ATDT^1\13"
  350. !
  351. matchstr  1 72 "CONNECT 1200\13\10"
  352. matchstr  2 73 "CONNECT 2400\13\10"
  353. matchstr  3 50 "NO CARRIER\13\10"
  354. matchstr  4 50 "ERROR\13\10"
  355. matchstr  5 52 "NO DIALTONE\13\10"
  356. matchstr  6 53 "BUSY\13\10"
  357. matchstr  7 54 "NO ANSWER\13\10"
  358. matchread 700
  359. jump 59
  360. !
  361. @LABEL 72
  362. note "Communicating at 1200 bps." 2
  363. serreset 1200, 0, 8, 1
  364. jump 75
  365. !
  366. @LABEL 73
  367. note "Communicating at 2400 bps." 2
  368. serreset 2400, 0, 8, 1
  369. !
  370. !
  371. @LABEL 75
  372. ifANSWER 76
  373. pause 30
  374. @LABEL 76
  375. exit 0
  376. !
  377. ! @ANSWER for PowerPort BRONZE
  378. ! Set up the modem to answer
  379. !
  380. @LABEL 100
  381. write "ATS0=1\13"
  382. matchclr
  383. matchstr 1 101 "OK\13\10"
  384. matchread 30
  385. jump 59
  386. !
  387. @LABEL 101
  388. matchstr  1 77 "RING\13\10"
  389. matchstr  2 72 "CONNECT 1200\13\10"
  390. matchstr  3 73 "CONNECT 2400\13\10"
  391. matchstr  4 50 "NO CARRIER\13\10"
  392. matchstr  5 50 "ERROR\13\10"
  393. matchstr  6 52 "NO DIALTONE\13\10"
  394. matchstr  7 53 "BUSY\13\10"
  395. matchstr  8 54 "NO ANSWER\13\10"
  396. matchread 700
  397. jump 101
  398. !
  399. @LABEL 77
  400. userhook 1
  401. note "Answering phone..." 2
  402. jump 101
  403. !